package com.javaweb;

import org.springframework.boot.Banner.Mode;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

import com.javaweb.listener.ApplicationEnvironmentListener;
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;

/**
 * 启动类
 * @author tank2140896
 */
@SpringBootApplication(exclude={
	DataSourceAutoConfiguration.class,//去除数据源默认配置
	RedisAutoConfiguration.class,RedisRepositoriesAutoConfiguration.class,//去除redis默认配置
	FreeMarkerAutoConfiguration.class//去除freemarker自动配置
})
//@MapperScan("com.javaweb.web.dao")//这样写就不必在所有的dao接口上加@Mapper
@EnableScheduling//开启定时任务
@EnableAsync//开启异步任务
@EnableEncryptableProperties//开启配置文件关键信息加密
public class Application {
	
	/**
	 * 应用监听器
	 */
	private static final ApplicationListener<?>[] APPLICATION_LISTENER = new ApplicationListener[] {new ApplicationEnvironmentListener()};
	
	/**
	 * 启动的main方法
	 * <p>
	 * 最简单的可以写为：SpringApplication.run(Application.class,args);
	 * @param args 参数
	 */
    public static void main(String[] args) {
    	SpringApplication springApplication = new SpringApplication(Application.class);
        springApplication.setBannerMode(Mode.OFF);
        springApplication.addListeners(APPLICATION_LISTENER);
        springApplication.run(args);
    }
    
}
